Rotational energies are quantized. For a diatomic molecule like CO or HCl, the allowed rotational energies are
The number of degenerate states g_j for each level j is 2j+1. The rotational partition function is therefore